package br.ufmg.vod.wbr.graphs;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class GoogleIDLenCalc {

	public static void main(String[] args) throws NumberFormatException, IOException {
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		BufferedReader reader = new BufferedReader(new FileReader(args[0]));
		String line;
		while ((line = reader.readLine()) != null) {
			String[] split = line.split(",");
			
			int id1 = Integer.parseInt(split[0]);
			int id2 = Integer.parseInt(split[1]);
			
			Integer integer = map.get(id1);
			if (integer == null) {
				integer = 0;
			}
			map.put(id1, integer.intValue() + 1);
			
			integer = map.get(id2);
			if (integer == null) {
				integer = 0;
			}
			map.put(id2, integer.intValue() + 1);
		}
		
		for (Entry<Integer, Integer> e : map.entrySet()) {
			System.out.println(e.getKey() + "   " + e.getValue());
		}
	}
}